<script>
function register() {
	var valid = true;
	if($j('#firstname').val() == "") { $j('#firstname').css('background','#fff3a0'); valid = false; }
	else { $j('#firstname').css('background','#e7e7e7'); }
	if($j('#lastname').val() == "") { $j('#lastname').css('background','#fff3a0'); valid = false; }
	else { $j('#lastname').css('background','#e7e7e7'); }
	if($j('#address').val() == "") { $j('#address').css('background','#fff3a0'); valid = false; }
	else { $j('#address').css('background','#e7e7e7'); }
	if($j('#city').val() == "") { $j('#city').css('background','#fff3a0'); valid = false; }
	else { $j('#city').css('background','#e7e7e7'); }
	if($j('#email').val() == "") { $j('#email').css('background','#fff3a0'); valid = false; }
	else { $j('#email').css('background','#e7e7e7'); }
	if($j('#username').val() == "") { $j('#username').css('background','#fff3a0'); valid = false; }
	else { $j('#username').css('background','#e7e7e7'); }
	if($j('#password').val() == "") { $j('#password').css('background','#fff3a0'); valid = false; }
	if($j('#password').val() != $j('#password2').val()) { valid = false; }
	if (valid) {
		document.registerForm.submit();
	}
}
function login() {
	document.loginForm.submit();
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=500,height=200,left = 440,top = 225');");
}

</script>
 <div class="store">
            <div class="customer">
            	<h2 class="blue">Previous Customers</h2>
                <div class="text">
                	<p>Have you shopped here before? We will have your details on file. Enter your username and password to login to your account.</p>
                    <?php if($this->session->flashdata('error_login')) { ?><p class="error"><br />Wrong username/password. Please try again!</p><?php } ?>
                </div>
                <div class="box blue">
                <form name="loginForm" method="post" action="<?=base_url()?>store/validate">
                	<dl><dt>Username</dt><dd><input type="text" name="username" class="profile rounded" /></dd></dl>
                    <dl><dt>Password</dt><dd><input type="password" name="password" class="profile rounded" /></dd></dl>
                    <span class="forgot"><a href="javascript:popUp('<?=base_url()?>forgot-password')">Forgot password?</a></span> <a href="javascript:login()"><span class="button3">Login</span></a>
                </form>
                </div>
                <dl></dl>
            </div>
            <div class="customer">
            <form name="registerForm" method="post" action="<?=base_url()?>store/register">
            	<h2 class="blue">New Customers</h2>
                <p>Is this the first time you have shopped with us? Sign up an account with us so we have your details on file and shopping with us in the future will be simple as logging into your account</p><br />
                <dl>
                	<dt class="blue">First Name <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="firstname" id="firstname" /></dd>
                    <dt class="two blue">Address <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="address" id="address" /></dd>
                </dl>
                <dl>
                	<dt class="blue">Family Name <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="lastname" id="lastname" /></dd>
                    <dt class="two blue">City <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="city" id="city" /></dd>
                </dl>
                <dl>
                	<dt class="blue">Email <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="email" id="email" /></dd>
                    <dt class="two blue">State<dd><input type="text" class="profile rounded" name="state" /></dd>
                </dl>
                <dl>
                	<dt class="blue">Username <span class="error">*</span></dt><dd><input type="text" class="profile rounded" name="username" id="username" /></dd>
                    <dt class="two blue">Country</dt><dd>
                    	<select name="country">
                        <?php foreach($countries as $ct) { ?>
                        	<option value="<?=$ct['name']?>"<?php if($ct['code'] == "AU") print ' selected="selected"'; ?>><?=$ct['name']?></option>
                        <?php } ?>
                        </select>
                    </dd>
                </dl>
                <dl>
                	<dt class="blue">Password <span class="error">*</span></dt><dd><input type="password" class="profile rounded" name="password" id="password" /></dd>
                    <dt class="two blue">Postcode</dt><dd><input type="text" class="profile rounded" name="postcode" id="postcode" /></dd>
                </dl>
                <dl>
                	<dt class="blue">Retype password</dt><dd><input type="password" class="profile rounded" name="password2" id="password2" /></dd>
                    <dt class="two blue">Telephone</dt><dd><input type="text" class="profile rounded" name="phone" id="phone" /></dd>
                </dl>
                <dl></dl>
                <div class="note"><span class="error">*</span> denotes required fields</div>
                <a href="javascript:register()"><span class="button3">Sign Up</span></a>
                <dl></dl>
            </form>
            </div>
        </div>